#include<iostream>
using namespace std;
#include<vector>
int main()
{
    int num;
    cin >> num;
    int count = 0;
    for (int i = 6; i <= num; i++)
    {
        vector<int> arr;
        for (int j = 1; j <= i; j++)
        {
            if (i % j == 0)
                arr.push_back(j);
        }
        int n = 0;
        for (int j = 0; j < arr.size() - 1; j++)
        {
            n += arr[j];
        }
        if (n == arr[arr.size()-1])
            count++;
    }
    cout << count;
    return 0;
}